<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;

class TextController extends Controller
{
	public function actionCreate(){
       $xml=file_get_contents($_GET);
       $xml=simplexml_load_string($xml);
      //接收消息的类型
       if (MsgType='text') {
       	//输入数字1，返回收到
       	if ($Content=='1') {
       		$Content='收到文本消息';
       		$str="<xml><ToUserName></ToUserName><FromUserName></FromUserName><CreateTime>1348831860</CreateTime><MsgType></MsgType><Content></Content><MsgId>1234567890123456</MsgId></xml>"
       		echo $str;
       		exit;
       	}
       	else if ($Content=='2') {
       		$Content="收到图片消息";
       		$str="<xml><ToUserName></ToUserName><FromUserName></FromUserName><CreateTime>1348831860</CreateTime><MsgType></MsgType><Content></Content><MsgId>1234567890123456</MsgId></xml>"
       		echo $str;
       	}
       	else
       	{
       		echo "公众号故障";
       	}
       }
	}
}